#include "RegistroVariableFeedData.h"

RegistroVariableFeedData::RegistroVariableFeedData()
{
        this->URL = "";
        this->IdFeed = 0;
}

RegistroVariableFeedData::~RegistroVariableFeedData()
{
}

TCId RegistroVariableFeedData::getIdFeed()
{
        return this->IdFeed;
}

string RegistroVariableFeedData::getURL()
{
        return this->URL;
}

void RegistroVariableFeedData::setIdFeed(TCId value)
{
        this->IdFeed = value;
}

void RegistroVariableFeedData::setURL(string value)
{
        this->URL = value;
}

void RegistroVariableFeedData::fillBuffer()
{
        this->setTamanioBuffer(sizeof(this->IdFeed) + this->URL.size());
        this->crearBuffer();
        this->putIntoBuffer(&this->IdFeed, sizeof(this->IdFeed));
        this->putIntoBuffer((void*)this->URL.c_str(), this->URL.size());
}

void RegistroVariableFeedData::readFromBuffer()
{
        this->getFromBuffer(&this->IdFeed, sizeof(this->IdFeed));

        char* sURL;
        sURL = (char*)malloc(this->bytesLeft() + 1);
        memset(sURL, '\0', this->bytesLeft() + 1);

        this->getFromBuffer(sURL, this->bytesLeft());
        this->URL = string(sURL);
        free(sURL);
}



